<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./promise.js"></script>
</head>
<body>
    <h1>自定义Promise--将Promise改成ES6版本</h1>
    <script>
        // 使用自定义的Promise
        // 创建多个Promise对象
        const p1 = new Promise((resolve,reject)=>{
            setTimeout(()=>{
                resolve("成功1")
            },0);
        })
        const p2 = Promise.resolve("操作成功2");
        const p3 = Promise.resolve("操作成功3");
        const p4 = Promise.reject("操作失败4");

        const res  = Promise.all([p1, p2, p3]);
        console.log(res);
        
        const res2  = Promise.race([p1, p2, p3]);
        console.log(res2);
    </script>
</body>
</html>